﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/DefaultNonMenu.master" AutoEventWireup="true" CodeBehind="Shopcart.aspx.cs" Inherits="Runda.EShop.Web.Customer.Shopcart" %>
<%@ Register assembly="Runda.EShop.Common.Component" namespace="Runda.EShop.Common.Component" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHeader" runat="server">
<script type="text/javascript">
    function Check() {
        var list = $("input[data-control='DecimalTextBox']");
        if (list.length == 0) {
            alert('购物车为空!');
            return false;
        }
        var flag = true;
        list.each(function () {
            if ($(this).val() == '') {
                flag = false; 
            }
        }
        );

        if(! flag)
        {
        alert('请输入数量');
        return false;
        }
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMain" runat="server">
<div class="i_tablebt_xian" style="margin:10px 0px 0px 0px; width:100%;">
        <span class="l"><img src="<%=ResolveUrl("~/images/ico/down_16x16.gif")%>" align="absmiddle" />我的购物车</span>
</div>
    <asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False" OnRowDeleting="gvList_RowDeleting"
        DataKeyNames="CartID,ProductID" OnRowDataBound="gvList_RowDataBound" Width="100%">
        <Columns>
            <asp:BoundField DataField="ProductCode" HeaderText="产品编号" ItemStyle-Width="80px" />
            <asp:BoundField DataField="ProductName" HeaderText="产品名称" ItemStyle-Width="200px" /> 
            <asp:BoundField DataField="Standard" HeaderText="规格" ItemStyle-Width="150px" /> 
            <asp:BoundField DataField="BatchCode" HeaderText="批次" /> 
            <asp:BoundField DataField="DueDate" HeaderText="效期" DataFormatString="{0:yyyy-MM-dd}" /> 
            <asp:TemplateField HeaderText="库存">
                <ItemTemplate>
                    <asp:Label ID="lblInventory" runat="server" Text='<%# string.Format("{0:N}",Eval("Inventory")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="计量单位">
                <ItemTemplate>
                    <asp:Label ID="lblUnit" runat="server" Text='<%# Eval("Unit") %>'></asp:Label>
                    <%--<asp:DropDownList ID="ddlUnit" runat="server">
                    <asp:ListItem Text="盒" Value="盒"></asp:ListItem>
                    <asp:ListItem Text="支" Value="支"></asp:ListItem>
                    </asp:DropDownList>--%>
                </ItemTemplate>
                <ItemStyle Width="50px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="数量">
                <ItemTemplate>
                    <cc1:DecimalTextBox ID="txtQuantity" runat="server" Text='<%# string.Format("{0:N}",Eval("Quantity")) %>' Width="60px"></cc1:DecimalTextBox> 
                </ItemTemplate>
                <ItemStyle Width="60px" />
            </asp:TemplateField> 
            <asp:TemplateField HeaderText="备注">
                <ItemTemplate>
                    <asp:TextBox ID="txtRemark" runat="server" Text='<%# Eval("Remark")%>' MaxLength="100"></asp:TextBox> 
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="操作">
                <ItemTemplate>
                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="delete" ImageUrl="~/Images/ico/del15x15.jpg" ClientIDMode="Static"/>
                </ItemTemplate>
                <ItemStyle Width="40px" />
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <div class="i_tablebt_xian" style="margin:10px 0px 0px 0px; width:100%;"> 
</div>
    <asp:Panel ID="Panel1" runat="server" CssClass="banner7 r">
        <asp:LinkButton ID="btnSave" runat="server" onclick="btnSave_Click" ClientIDMode="Static" OnClientClick="return Check();" ValidationGroup="group1">下 订</asp:LinkButton>
  </asp:Panel>
    
    <asp:Panel ID="pnlGO" runat="server" CssClass="banner7 r" Visible="false">
        <asp:Label ID="Memo" runat="server" Text="Label"></asp:Label>
        <br />
    <%--<span id="Titlememo">您下定的货物正在补货（已下定），点击"确认下订"继续下单，点击"取消"将取消订单。</span>--%>
    <asp:LinkButton ID="lnkbtnOK" runat="server" ClientIDMode="Static" 
            OnClientClick="return Check();" ValidationGroup="group1" 
            onclick="lnkbtnOK_Click">确认下订</asp:LinkButton>
    <asp:LinkButton ID="lnkbtnCancel" runat="server" ClientIDMode="Static" 
            OnClientClick="return Check();" ValidationGroup="group1" 
            onclick="lnkbtnCancel_Click">取 消</asp:LinkButton>
    </asp:Panel>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
        ShowMessageBox="True" ShowSummary="False" ValidationGroup="group1" />
</asp:Content>
